home *** CD-ROM | disk | FTP | other *** search
- Path: news2.noc.netcom.net!news
- Newsgroups: comp.lang.c
- Subject: Re: operator % - compiler error
- Message-ID: <314DD835.33BE@willows.com>
- From: Tarang Deshpande <tarang@willows.com>
- Date: Mon, 18 Mar 1996 13:40:05 -0800
- References: <4ihuuh$6ul@hatathli.csulb.edu>
- Organization: NETCOM Network Operations
- NNTP-Posting-Host: daffy.willows.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
-
- David Cho wrote:
- > When I try to compile, I get an erro message for the following line:
- > x=663608941*y%pow(2,32) /*I want remainder*/
- > But the error message says "illegal use of floating point". What does
- > that mean? Isn't % used a an operator to calcuate the remainder?
-
- Although the % operator calculates the remainder it does so for two
- ints and not two floats or double. You need to change your code to
-
- x = ( long )( 663608941 * y ) % ( long )( pow ( 2, 32 ) );
-
-